<?php
/**
 * contact.php
 *
 * 前台处理
 * @author konakona
 * @date 2009-8-21
 */
class contact {
	/**
	* 检测客户提交的数据合法后发送到本方和客户方邮箱
	*@param $_post 用户提交的表单数据
	**/
	public static function run($_post){
		if($_post['secode']!=$_SESSION['konacode']){
			k::message('Your code is worring!','contact-us.html');
		}
		if($_post['RefusalAD']!=k::$config['FORMHASH']){
			k::message('External submission','index.html');
		}
		$email_check = k::check_email($_post['email']);
		if(!$email_check){
			k::message('Email is bad','contact-us.html');
		}
		$title = 'You has a new Message from Chinatravelguide!';
		$body = "<span style='color:gray'><a href='mailto:{$_post[email]}'>{$_post[name]}</a></span> at <span style='color:gray'>".date("Y-m-d h:i:s",time())."</span> say :";
		$body .="\r \t <p>{$_post[request]}</p>";
		$body .="\r \t <span style='color:red'><b>You can reply this e-mail to the client!</b></span>";
		k::import('plugin.mail');
		if(!mail::run($title,$body,$_post['email'],'contact@chinatravelguide.com.cn','chinatravelguide')){
			k::message('Sorry','javascript:history.go(-1);');
		} else {
			k::message('Your message has been successfully, please be patient reply','javascript:history.go(-1);');
		}
	}
}









